#include <bits/stdc++.h> using namespace std; class Complex { public: int real; int img; Complex(int r=0,int i=0) { real=r; img=i; } friend Complex operator+(Complex c1,Complex c2); //friend void display() //operator overloading { } }; Complex operator+(Complex c1,Complex c2) //operator overloading { Complex temp; temp.real=c1.real+c2.real; temp.img=c1.img+c2.img; return temp; } int main() { Complex c1(2,5),c2(3,5),c3; c3=c1+c2; cout<<c3.real<<"+i"<<c3.img<<endl; return 0; }