You may provide `+=' and then code `+' in terms of it
1 2 3 4 5 6 7 8
Complex& Complex::operator+=(const Complex &right){ //as a member function
this->re += right.re;
this->im += right.im;
}
const Complex operator+(Complex a, const Complex &b){ //as a non-member function
return a += b;
}
The return type of operator= needs to be a const Complex &
Then you do not need to create the Complex* comp - you actually want to be modifying the object on which the assignment operator is called, either by using the this pointer, or by simply putting re = right.re etc. inside the operator= function definition.
Finally you want to return a const reference to the current object - you do this by dereferencing the this pointer: return *this;
Also, your + and - operators should be returning a copy of a Complex object, not a pointer to a Complex object.