You can refer to a name of a class member only in one of the following contexts:
- In the scope of its class or a class derived from its class 0
- After the . operator applied to an object of the type of its class or a class derived from its class
- After the -> operator applied to a pointer to an object of its class or a class derived from its class
- After the :: scope resolution operator applied to the name of its class or a class derived from its class