Computer Science 1037A/B Lecture Notes - Lecture 25: Function Prototype
Document Summary
Friend function: a function that is not a member of a class, but has access to private members of the class. A friend function can be a stand-alone function or a member function of another class. It is declared a friend of a class with the friend keyword in the function prototype. Friend function may be a member of another class. An entire class can be declared a friend of a class. If frclass is a friend of aclass, then all member functions of frclass have unrestricted access to all members of aclass, including the private members. In general, restrict the property of friendship to only those functions that must have access to the private members of a class.