 <p>The compiler seems to place the casting from <code>const char&amp;</code> to <code>char</code> on the same level as upcasting <code>std::ostringstream</code> to <code>std::ostream</code> when the overload resolution comes.</p> <p>The solution could be to template the type of <code>operator&lt;&lt;</code> to avoid the upcasting:</p> <pre><code>namespace _impl { template &lt;typename T, typename Y&gt; Y&amp; operator&lt;&lt;(Y&amp; osstr, const T&amp; val) { return osstr; } } </code></pre>