Just a little problem that I can't fix.
Suppose that I have these four classes

class B  {};

class D1: public B  {};

class D2: public B  {};

class E: public D1  {};

this test:

void foo(D1 *)    {}
void foo(D2 *)    {}

int main()
{
    E *e = new E;
    foo(e);
    return 0;
}
work just fine

but this one

void foo(shared_ptr<D1>)        {}
void foo(shared_ptr<D2>)        {}

int main()
{
    shared_ptr<E> e(new E);
    foo(e);
    return 0;
}
the compiler say that the foo(boost::shared_ptr<E>&)' is ambiguous.

Please, can someone help me to understand why and how can I fix this problem without changing the functions name.
Thanks

Boost 1.35
GCC 4.4.1

regards