You ask how to fix it, but then say you can't change A or B. Without changing A or B, it is obviously impossible to fix your problem.

Imagining for a moment that you can modify A or B, you can:
1. Pass the type as an additional template parameter to the A template (e.g. class B: public A<B<T>, int>).
2. (best solution) Modify the A template do that it doesn't need T to be complete in its definition, but only in the definition its member functions. (e.g.
Code:
template <class T>
class A
{
  void f(){
    typedef typename T::MyInt MyInt;
    //use MyInt
  }
};
3. Add a level of indirection via a traits class or similar:
Code:
template <class T, class Traits>
class A
{
  typedef typename Traits::MyInt MyInt;
};

class BTraits
{
public:
  typedef int MyInt;
};

template <class T>
class B : public A<B<T>, BTraits>
{
public:
  typedef BTraits::MyInt MyInt;
};