Correct option is B
A friend function is not a member of a class. It is declared using the friend keyword and can access private and protected members of the class, but it is not defined within the class scope and does not belong to the class. Instead, it is defined as an independent function.
Important Key Points:
· Friend functions are declared inside the class using the friend keyword but defined outside the class.
· Although it can access private and protected members of the class, it is not a member of the class itself.
· They can access private/protected members of the class but do not belong to the class.
· Examples of friend functions include operator overloading functions and utility functions that work with multiple classes.
Knowledge Booster:
1.Member function: These are defined inside the class and are members of the class.
2.Constructor: A special type of member function used to initialize objects.
3.Data member: Variables defined inside the class to hold data.