title: When should you use 'friend' in C++?
body: <p>I have been reading through the <a href="http://yosefk.com/c++fqa/" rel="noreferrer">C++ FAQ</a> and was curious about the <a href="http://yosefk.com/c++fqa/friend.html" rel="noreferrer"><code>friend</code></a> declaration. I personally have never used it, however I am interested in exploring the language. </p>
  
  <p>What is a good example of using <code>friend</code>?</p>
  
  <hr>
  
  <p>Reading the FAQ a bit longer I like the idea of the <code>&lt;&lt;</code> <code>&gt;&gt;</code> operator overloading and adding as a friend of those classes. However I am not sure how this doesn't break encapsulation. When can these exceptions stay within the strictness that is OOP?</p>