#include <iostream>

using namespace std;
class complex
{
    float real;
    float imag;
    public:
    complex()
    {
        real=0;
        imag=0;
    }
    complex(float x,float y)
    {
        real=x;
        imag=y;
    }
    void display()
    {
        cout<<real<<"+j"<<imag<<endl;
    }
    friend complex sum(complex c1,complex c2);
};
complex sum(complex c1,complex c2)
{
    complex t;
    t.real=c1.real+c2.real;
    t.imag=c1.imag+c2.imag;
    return t;
}

int main()
{
    complex c1(5.1,3.2),c2(2.1,3.6),c;
    c=sum(c1,c2);
    c1.display();
    cout<<"\n";
    c2.display();
    cout<<"\n"<<"after addition:";
    c.display();
    return 0;
}
     
           
Note: Need to be arranged in compiler after copied
   

 OutPut:

5.1+j3.2
2.1+j3.6
after addition:7.2+j6.8