error while making custom cout
<p>I am trying to make a custom cout class that outputs text to console output and log file when i try to run a version of this code that does not handle chaining (out&lt;&lt;"one"&lt;&lt;"two") it works fine, but when i try to make it handle chaining it gives me "too many parameters for this operator function". What am i missing?</p>

<pre><code>class CustomOut
{
    ofstream of;

public:
   CustomOut()
   {
     of.open("d:\\NIDSLog.txt", ios::ate | ios::app);
   }

   ~CustomOut()
   {
     of.close();
   }

   CustomOut operator&lt;&lt;(CustomOut&amp; me, string msg)
    {
    of&lt;&lt;msg;
    cout&lt;&lt;msg;

    return this;
}};
</code></pre>
