title: Pass class with templated method as template parameter with GCC
body: <p>Is it possible to pass object of a class with templated method as a template parameter under GCC? All search I conducted pointed me to questions regarding templated class, which is not applicable in my case.</p>
  
  <p>Sample code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class Foo
  {
  public:
      template&lt;typename T&gt;
      void print(const T&amp; arg) const
      {
          std::cout &lt;&lt; arg &lt;&lt; std::endl;
      }
  };
  
  template&lt;typename A&gt;
  void print(const A&amp; printer)
  {
      printer.print&lt;int&gt;(1);
  }
  
  int main()
  {
      Foo foo;
      print&lt;Foo&gt;(foo);
      return 0;
  }
  </code></pre>
  
  <p>Compiling under MinGW.org GCC-6.3.0-1 I get the following results:</p>
  
  <pre><code>tmpl.cpp: In function 'void print(const A&amp;)':
  tmpl.cpp:16:19: error: expected primary-expression before 'int'
       printer.print&lt;int&gt;(1);
                     ^~~
  tmpl.cpp:16:19: error: expected ';' before 'int'
  </code></pre>
  
  <p>VisualStudio compiles the same code cleanly, application works as expected. If I make <code>print</code> function not templated, so that is explicitly takes object of <code>Foo</code> it works as expected both compilers. </p>