title: Error when inserting string << overload C++
body: <p>I am trying to overload the &lt;&lt; operator on a class in C++. Whenever I insert a normal string, like the " " into the output stream I get compilation errors that I cannot make sense of. I have done this once before with no problems, so I am very confused.</p>
  
  <pre><code>friend std::ostream&amp; operator&lt;&lt;(std::ostream&amp; out, Variable v);
  
  std::ostream&amp; operator&lt;&lt;(std::ostream&amp; out, Variable v) {
      out &lt;&lt; v.type;
      out &lt;&lt; " ";
      out &lt;&lt; v.name;
      return out;
  }
  </code></pre>
  
  <p>And here is the output:</p>
  
  <pre><code>src/Variable.cpp: In function 'std::ostream&amp; operator&lt;&lt;(std::ostream&amp;, Variable)':
  src/Variable.cpp:35:9: error: no match for 'operator&lt;&lt;' in 'out &lt;&lt; " "'
  src/Variable.cpp:35:9: note: candidates are:
  src/Variable.cpp:33:15: note: std::ostream&amp; operator&lt;&lt;(std::ostream&amp;, Variable)
  src/Variable.cpp:33:15: note:   no known conversion for argument 2 from 'const char [2]' to 'Variable'
  In file included from /usr/local/Cellar/gcc/4.7.0/gcc/lib/gcc/x86_64-apple-darwin10.8.0/4.7.0/../../../../include/c++/4.7.0/string:54:0,
               from src/../inc/Variable.h:4,
               from src/Variable.cpp:1:
  /usr/local/Cellar/gcc/4.7.0/gcc/lib/gcc/x86_64-apple-darwin10.8.0/4.7.0/../../../../include/c++/4.7.0/bits/basic_string.h:2750:5: note: template&lt;class _CharT, class _Traits, class _Alloc&gt; std::basic_ostream&lt;_CharT, _Traits&gt;&amp; std::operator&lt;&lt;(std::basic_ostream&lt;_CharT, _Traits&gt;&amp;, const std::basic_string&lt;_CharT, _Traits, _Alloc&gt;&amp;)
  /usr/local/Cellar/gcc/4.7.0/gcc/lib/gcc/x86_64-apple-darwin10.8.0/4.7.0/../../../../include/c++/4.7.0/bits/basic_string.h:2750:5: note:   template argument deduction/substitution failed:
  src/Variable.cpp:35:9: note:   mismatched types 'const std::basic_string&lt;_CharT, _Traits, _Alloc&gt;' and 'const char [2]'
  make: *** [bin/Variable.o] Error 1
  </code></pre>