Skip to main content

Friend Functions


Friend functions

In this part you will learn: 1. What are friend functions 2. Uses of friend function 3. Syntax of friend function 4. Program 5. Output Friend Function A function declared as friend function isn’t really a part of member functions of a class but it can access the public as well as the private members of the class which considers the function as its friend. There are three most common uses of friend function. • To access member variables of two different classes to perform operations on it. • Making one class friend of the other to allow access to class members

Add new comment

File attachments