title: operator () overload with template C++
body: <p>I have a simple class for which I want to overload operator as below</p>
  
  <pre><code>class MyClass
  {
     public:
        int first;
  
        template &lt;typename T&gt;
        T operator () () const { return first; }  
  };
  </code></pre>
  
  <p>And the somewhere else I have</p>
  
  <pre><code>MyClass obj;
  
  int i = obj(); // This gives me an error saying could not deduce
                 // template argument for T
  </code></pre>
  
  <p>Can someone help me with this error, much appreciated. Thank you.</p>
  
  <p>edit:</p>
  
  <p>This has something to do with the operator(), for example if i replace the function with</p>
  
  <pre><code>    template &lt;typename T&gt;
      T get() const { return first;}
  </code></pre>
  
  <p>it works. Appreciate all the responses.</p>