title: How to filter input streamed to clog
body: <p>I'am currently trying to filter input streamed to the 'clog' streambuffer. Therefore i wanted to create a class 'MyClog' which overloads it's &lt;&lt; operator and filters the input streamed to it before forwarding the filtered input to the clog streambuffer.</p>
  
  <p>The filtering depends on an internal state of the MyClog class. Also i want to overload the operator using a template, so i just have to implement one method.</p>
  
  <p>example</p>
  
  <pre><code>clog &lt;&lt; "This is a Test No." &lt;&lt; 1;
  
  myclog &lt;&lt; "This is a Test No." &lt;&lt; 2
  </code></pre>
  
  <p>Depending of the internal state of myclog the message is printed out via clog.</p>
  
  <p>My overloaded operator works if i'am not using a template, what am i doing wrong? And what is the difference between <code>template&lt;typename T&gt;</code> and <code>template&lt;class T&gt;</code>?</p>
  
  <p>Here is an excerpt of my code.</p>
  
  <pre><code>template&lt;typename T&gt;
  class MyClog {
  
  private:
  bool state=false;
  
  public:
  MyClog&amp; operator&lt;&lt;(const T&amp; arg){
      if(state){
          clog &lt;&lt; arg;
      }
      return *this;
  }
  </code></pre>