title: When can't an object be converted to a reference?
body: <p>I want to compile the following line of code from <a href="http://code.google.com/p/enhsim" rel="noreferrer">http://code.google.com/p/enhsim</a>:</p>
  
  <pre><code>enh::eout &lt;&lt; enh::setw(26);
  </code></pre>
  
  <p>gcc gives the following error:</p>
  
  <pre><code>error: no match for 'operator&lt;&lt;' in 'enh::eout &lt;&lt; enh::setw(26)'
  </code></pre>
  
  <p>But the <code>EnhSimOutput</code> class (of which <code>enh::eout</code> is an instance) does declare:</p>
  
  <pre><code>EnhSimOutput&amp; operator&lt;&lt; (setw&amp; p);
  </code></pre>
  
  <p>This problem goes away if I implement a version of the operation that accepts the object by value:</p>
  
  <pre><code>EnhSimOutput&amp; operator&lt;&lt; (setw p);
  </code></pre>
  
  <p>or if I create the <code>enh::setw</code> object as a local, i.e.:</p>
  
  <pre><code>enh::setw wValue(26);
  enh::eout &lt;&lt; wValue;
  </code></pre>
  
  <p>My question is this: why does gcc not select the "by-reference" version of the operator to begin with?</p>
  
  <p>The developers who wrote this code clearly made it compile, yet default gcc refuses to do it. Why is there a difference between an object declared separately as a local variable and a local created inline?</p>