The name M of a member of a class X has class scope “local to X”; it can be used only in the following situations:
- In member functions of X
- In expressions such as x.M, where x is an object of X
- In expressions such as xptr->M, where xptr is a pointer to an object of X
- In expressions such as X::M or D::M, where D is a derived class of X
- In forward references within the class of which it is a member
Names of functions declared as friends of X are not members of X; their names simply have enclosing scope.