title: Convert Class Object to String
body: <p>I have an assignment for a class that requires me to convert a class object, <code>clock_time</code>, to a string using two required, instructor-defined empty functions: <code>to_string()</code>  and an overloaded &lt;&lt; operator. I am not able to get it to work and I am unsure why.</p>
  
  <pre><code>clock_time::clock_time(int h, int m, int s)
  {
      set_time(h, m, s);
  }
  
  void clock_time::set_time(int h, int m, int s)
  {
      _seconds = h * 3600 + m * 60 + s;
  }
  
  string to_string(clock_time c)
  {
      ostringstream ss;
      ss &lt;&lt; c;
      return ss.str();
  }
  
  ostream&amp; operator&lt;&lt;(ostream &amp;out, clock_time c)
  {
      out &lt;&lt; to_string(c);
      return out;
  }
  </code></pre>