title: Attempting to convert int to string
body: <p>It's quite clear from the code below that I am attempting to convert an int to a string.</p>
  
  <pre><code>#include &lt;sstream&gt;
  #include &lt;string&gt;
  #include &lt;iostream&gt;
  
  int num = 1;
  ostringstream convert;
  convert &lt;&lt; num;
  string str = convert.str();
  </code></pre>
  
  <p>However, I get the error message</p>
  
  <blockquote>
    <p>Line 7: error: expected constructor, destructor, or type conversion
    before '&lt;&lt;' token</p>
  </blockquote>
  
  <p>What I am doing wrong? This is basically the same snippet of code that everyone recommends to convert an int to a string.</p>