I am trying to overload assignment operators for two different template classes but with the same template type:
template <class DataType> class Foo
{
public: Foo<data_type>& operator=(Bar<data_type> const &bar);
};
template <class DataType> class Bar
{
public: Bar<data_type>& operator=(Foo<data_type> const &foo);
};
However when I try:
Foo<int> a;
Bar<int> b = a;
I get the error:
No viable conversion from 'Foo< int >' to 'Bar< int >'.
How do I achieve this?