All the overloaded operators (such as operator+ and operator-) can be modeled as member functions, except for the stream output operator<<, which is a global function rather than a member function and must be declared a friend function. The overloaded operators that are class members are all defined as primitive operations.
To illustrate operator overloading, consider two classes, Complex and MainClass, defined as follows: