I want to know how to modify the default addition property of a class. For example, if I were to create a class Complex, then the addition goes by adding the real components and the imaginary components. Suppose I have two complex numbers z1 and z2. I'd like it such that whenever I put: function (z1+z2) (here function is anything cout, return, parameter...). Then it would automatically use this addition rule, defined perhaps in the class.
I know a little Python, and it's very easy there, you just have to put:
def __add__(x,y): (the general way, not specifically this case)
return x + y
I wonder how to do this in C++.