The usual arithmetic operators can be overloaded for types provided there is not already a definition of the operator for that type.
So operator+ cannot be overloaded for the int type, but can be overloaded for the example Pair type.
There are two choices for overloading an operator for a class type:
- as a member function of the class
- as a non-member function.
In case of a non-member, the function can either be a friend or not, depending on whether you need or want to access private members of instances.