#include
using namespace std;
class Complex{
public:
Complex(){
real=0;
imag=0;}
Complex(double a,double i){
real=a;
imag=i;}
Complex(double a){
real=a;
imag=0;}
operator double(){
return real;}
friend istream & operator >>(istream &,Complex &); //<---这里声明要与实现参数类型一致才可以!加&引用
friend ostream & operator <<(ostream &,Complex&); //<---同上
friend Complex operator+(Complex &,Complex &);
private:
double real;
double imag;
};