Expect to come across this popular question in Infosys interview questions for freshers. Friend function - If a function is designated as a 'friend' of a certain class, it has access to the class's protected and private members.  Friend class - similar to function, if a class is marked as a friend of another class, it has access to that class's protected and private members.  As an example,