Compiler Error C2801

'operator symbol' must be a nonstatic member

The specified overloaded operator was not a member of a class, structure, or union, and/or was declared as static.

The following operators can only be overloaded in class scope as nonstatic members: assignment operator '=', class member access operator '->', subscripting operator '[]', and function call operator '( )'.

The following are examples of this error:

operator[]();            // error, not a member
class A
{
   static operator->();  // error, static
   operator()();         // OK
};