ProAnswers.org

How can we access protected and private members of a class?

In the case of members protected and private, these could not be accessed from outside the same

class at which they are declared. This rule can be transgressed with the use of the friend keyword in a

class, so we can allow an external function to gain access to the protected and private members of a class.