In C++, you can overload
operators, such as the output operator, just as you can overload ordinary
functions. To overload an operator, you proceed as though you were
defining an ordinary function, except that you substitute the operator
symbol for the function name, and you add the symbol operator
.
The ordinary definition pattern follows:
data type function name (parameters) { body }
The operator-overloading definition pattern for a binary operator follows:
data type operatoroperator symbol (left parameter type and name, right parameter type and name) { body }