free function and inheritance
<p>I am trying a basic thing with two classes and a free functions. First I have two classes : </p>

<pre><code>struct BASE{
    BASE(int a = 0):a_(a){};
    virtual ~BASE(){};
    virtual void foo(){std::cout &lt;&lt; "BASE " &lt;&lt; std::endl;}
    int a_;
};

struct DERIVED: public BASE{
    DERIVED():BASE(){};
    void foo(){std::cout &lt;&lt; "DERIVED " &lt;&lt; std::endl;}
};
</code></pre>

<p>then I fill up a std::vector (or boost::ptr_vector)</p>

<pre><code>std::vector&lt;BASE* &gt; vec;    
vec.push_back( new BASE(2));
vec.push_back( new DERIVED);
</code></pre>

<p>If I call my function foo, no pb the virtual stuff works well,
but  if I create two free functions :</p>

<pre><code>void foo(BASE*   a, DERIVED*   b){
    std::cout &lt;&lt; " mix base/derived " &lt;&lt; std::endl;
}

void foo(BASE*   a, BASE*   b){
    std::cout &lt;&lt; " full base " &lt;&lt; std::endl;
}
</code></pre>

<p>if I do </p>

<pre><code>foo(vec[0], vec[1]); //failed
</code></pre>

<p>I will get the message </p>

<pre><code>full base
</code></pre>

<p>Well it is logical because I have vector of BASE*, but does it exist anyway 
to get the good call to my free function ? I need the inheritance so I can not really separate the 2 classes because I must fill up this container</p>

<p>Moreover at the end my vector will be fill up randomly, so I can not know by advance how cast properly.</p>
