### Overloading Unary Operators

You can overload a prefix unary operator by declaring a nonmember function taking one argument or a nonstatic member function taking no arguments.

When you prefix a class object with an overloaded unary operator, for example:

    class X
    {
    // ...
    };
    void main ()
    {
          X x;
          !x;       // overloaded unary operator
    }

the operator function call !x can be interpreted as: x.operator !() or operator!(x) . depending on the declarations of the operator function. If both forms of the operator function have been declared, argument matching determines which interpretation is used.

argument matching

Overloading Binary Operators
Overloading Operators
Special Overloaded Operators
Restrictions on Overloaded Operators