The Friend function and friend class in C++ are the techniques used to access the private members of a class by using friend keyword.Friend function is a function used with a friend keyword to grant a non-member function access to the private members of a class.Friend class is a class used with a friend keyword to access the private members of another class.