C++ Friend Function - Quiz Explanation

The answers you selected are indicated below, along with text that explains the correct answers.
 
1. A friend function declaration:
  A. gives nonmember functions access to hidden class members
  B. is another term for an overloaded function within a class
  C. is any function created for you by the compiler (such as a default constructor)
  D. is any function outside the class with the same name as a function in the class
  The correct answer is A.
A friend function is not a member of the class, but has access as if it were.

2. A friend function declaration appears:
  A. in the header of the friend function outside the class
  B. inside the class declaration to which it is a friend
  C. as a separate declaration inside main()
  D. anywhere prior to the function invocation
  The correct answer is B.
The friend function definition appears elsewhere, but the declaration using the keyword friend must appear in the class. In this course, we place it in the public access section, but it can go anywhere.

3. How is a static member function similar to a friend function?
  A. A static member function is like a friend function that doesn't need to be public:.
  B. A friend function is similar to binary operator overloading.
  C. A friend function has an implicit this parameter .
  D. A friend function does not have direct access to the class’s 1) private: and 2) protected: parts.
  Answer A is correct.
B, C and D are false. A static member function is like a friend function with a funny name that doesn't need to be public:.
Static member functions and top-level friend functions are similar in that neither has an implicit this parameter, and both have direct access to the class's 1) private: and 2) protected: parts. Except for overloaded operators, most friend functions end up actually being static member functions, because static member functions have a scoped name (they do not pollute the global namespace) and they do not have to be public:
They can also be
  1. private: or
  2. protected:.