title: Can I use boost operators to generate comparision functions for 2 objects(with different types) of class?
body: <p>I would like to use <a href="http://www.boost.org/doc/libs/1_38_0/libs/utility/operators.htm" rel="nofollow">boost operators</a> to generate comparision functions in such way:</p>
  
  <pre><code>template &lt;typename T&gt;
  class Foo : boost::less_than_comparable&lt;Foo&lt;T&gt;, Foo&lt;T2&gt; &gt; {
      private:
          int bar;
      public:
          template &lt;typename T2&gt;
          friend bool operator&lt;(Foo&lt;T&gt; const&amp; f1, Foo&lt;T2&gt; const&amp; f2) {
              if (typeid(T) == typeid(T2)) {
                  return f1.bar &lt; f2.bar;
              } else {
                  return sizeof(T) &lt; sizeof(T2);
              }
          }
  };
  </code></pre>
  
  <p>is it possible? The operator doesn't really need to be friend if we can use boost operators in some way to use it to generate the rest of operators.</p>