title: toString() kind of implementation in C++14
body: <pre><code>    class Fruit
  {
  private:
      std::string m_name;
      std::string m_color;
  
  public:
      Fruit(std::string name, std::string color)
          : m_name(name), m_color(color)
      {
      }
  
      std::string getName() const { return m_name; }
      std::string getColor() const { return m_color; }
  
  };
  
  class Apple : public Fruit
  {
  private:
      double m_fiber;
  
  public:
      Apple(std::string name, std::string color, double fiber)
          :Fruit(name, color), m_fiber(fiber)
      {
      }
  
      double getFiber() const { return m_fiber; }
  
      friend std::ostream&amp; operator&lt;&lt;(std::ostream &amp;out, const Apple &amp;a)
      {
          out &lt;&lt; "Apple (" &lt;&lt; a.getName() &lt;&lt; ", " &lt;&lt; a.getColor() &lt;&lt; ", " &lt;&lt; a.getFiber() &lt;&lt; ")\n";
          return out;
      }
  };
  </code></pre>
  
  <p>My question is regarding the friend function with the overloaded operator '&lt;&lt;'. 
  I need to understand some basics which are troubling me, for one why does the function return a reference to a stream ?</p>