How to define member class operator based on the class parameters <p>Is it possible to define different = operators for different template arguments. Let's assume that I want to use different methods for converting arguments of different types:</p> <pre><code>template &lt;class T,class U&gt; class cTest { private: public: T x; U y; //typical case cTest&lt;T,U&gt;&amp; operator =(const cTest&lt;T,U&gt; &amp;that) { return *this; } //operator = based on the LHS type 1 cTest&lt;uint16_t,U&gt;&amp; operator =(const cTest&lt;int,U&gt; &amp;that) { cout&lt;&lt;"cTest&lt;uint16_t,U&gt;&amp; operator =(const cTest&lt;int,U&gt; &amp;that)"&lt;&lt;endl; return cTest&lt;uint16_t,U&gt;(); } //operator = based on the LHS type 2 cTest&lt;uint8_t,U&gt;&amp; operator =(const cTest&lt;int,U&gt; &amp;that) { cout&lt;&lt;"cTest&lt;uint8_t,U&gt;&amp; operator =(const cTest&lt;int,U&gt; &amp;that)"&lt;&lt;endl; return cTest&lt;uint16_t,U&gt;(); } }; </code></pre>