title: Template class assignment between different types
body: <p>I have a struct (<code>School</code>) templated with a type T. The type T will be user defined types. One of the type (<code>CoedSystem</code>) will not be visible to the program as it is exported as a handle by the library. Other type (<code>Coed</code>) is defined in the program.</p>
  <pre><code>#include &lt;stdlib.h&gt;
  
  template&lt;typename T&gt;
  struct School
  {
      T var1;
      T var2;
      T var3;
      T var4;
      T var5;
      T var6;
      int otherData;
  };
  
  typedef unsigned int CoedSystem;  //this type is like a handle to hidden class
  
  class Coed
  {
      CoedSystem m_schoolSystem;
      int        m_yearEstablished;
  public:
      Coed&amp; operator=(const CoedSystem&amp; other)
      {
         this-&gt;m_schoolSystem = other;
         this-&gt;m_yearEstablished = 2020;
         return *this;
      }
  };  
  
  int main()
  {
      School&lt;Coed&gt; coedSchool;
      School&lt;CoedSystem&gt; coedSchool2;
      coedSchool2 = coedSchool;
  }
  </code></pre>
  <p>Question:
  How can I get the assignment coedSchool2= coedSchool, to work.
  Constraints:
  I want to achieve this with minimal key strokes. The number of variables in <code>School</code> will be double digit. An explicit assignment operation in <code>School</code> class copy assignment operator would be the easiest choice but also the lengthiest. Any suggestions? I am looking for something like metaprogramming, where compiler would look at <code>Coed::operator=(const CoedSystem&amp;)</code> and will use it to do the full <code>School</code> structure conversion by itself.</p>
  <p>Edited this article to republish the question. Previous question had lot of typo and I have fixed them in this edition.</p>
  <p>Thanks</p>