#ifndef COMPLEX_H_ #define COMPLEX_H_ #include using namespace std; class Complex { private: double re, im; public: Complex(double r, double i) : re(r), im(i) {} void print(); friend Complex operator +(const Complex &x, const Complex &y); }; void Complex::print() { cout << "(" << re << ", " << im << ")"; } inline Complex operator +(const Complex &x, const Complex &y) { return Complex(x.re + y.re, x.im + y.im); } #endif /* COMPLEX_H_ */