What is a friend function in C++? 

  • A function that always returns a friend object. 
  • A private function of a class. 
  • A function that can access private members of a class. 
  • A function that can only be called within its class.
A friend function in C++ is a special function that, although not a member of a class, has access to its private and protected members. This is used to allow non-member functions and other classes to access such members.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *