title: C++: How to require that one template type is derived from the other
body: <p>In a comparison operator:</p>
  
  <pre><code>template&lt;class R1, class R2&gt;
  bool operator==(Manager&lt;R1&gt; m1, Manager&lt;R2&gt; m2) {
      return m1.internal_field == m2.internal_field;
  }
  </code></pre>
  
  <p>Is there any way I could enforce that R1 and R2 must have a supertype or subtype relation?  That is, I'd like to allow either R1 to be derived from R2, or R2 to be derived from R1, but disallow the comparison if R1 and R2 are unrelated types.</p>