Could not find operator< for pointer type
<p>I'm trying to order a vector of pointers using insertion sort with an overloaded &lt; operator (cannot use any library).
Having a class which contains another, something like:</p>

<pre><code>class A {   
 vector&lt;B*&gt; v;
 void order();
}

class B {
int id;                         //each one is unique
virtual double num() {} const;
bool operator&lt;(const B* b2) const;
}

class B1: public B {
double num() {} const;
}

class B2: public B {
double num() {} const;
}
</code></pre>

<p>Each child has a different way of calculating num, and the sorting is done using the double returned by num as first criteria, and then id. (sorry for the indentation)</p>

<pre><code>void A::order() {

for (unsigned int p = 1; p &lt; v.size(); p++)    
{
    ClassB* tmp = v[p];
    int j;
    for (j = p; j &gt; 0 &amp;&amp; tmp &lt; v[j-1]; j--) // Error on this line
        v[j] = v[j-1];
    v[j] = tmp;     
}

}



bool B::operator&lt;(const B* b2) const {

cout &lt;&lt; "Operator &lt;\n";

if(this-&gt;num()!=b2-&gt;num())
    return this-&gt;num()&lt;b2-&gt;num();

return id&lt;d2-&gt;id;

}
</code></pre>

<p>I can't understand why the operator isn't being called when trying to compare the 2 pointers.</p>
