Where would you use a friend function vs. a static member function?

Section 11.5 “The C++ Programming Language” by Bjarne Stroustrup states that ordinary member functions get 3 things:

  1. access to internals of class
  2. are in the scope of the class
  3. must be invoked on an instance

friends get only 1.

static functions get 1 and 2.

Leave a Comment