Q:

C++ polymorphism: going from base class to derived class

class A{};

class B : A{};

void func(A* p)
{

      B* p2 = p; // Error

}

A:

Your code has several oddities.

You use private inheritance. In private inheritance you will not be able to convert to a derived class ever when you are not inside the class scope itself.
Even if you would inherit publicly, you will need at least one virtual function (and that should be the destructor) in the base class to use dynamic_cast.
Chances are you are doing something wrong when you need a lot of down-casts. You should probably rethink your design or usage of the provided API.

Typically, things would look like this:
class A { 
public:
  virtual ~A() {}
};

class Derived : public A {

};

void func(A* a) {
  if(Derived* d = dynamic_cast<Derived*>(a)) {
    // yeah, a is of type derived
  } else {
    // a is not of type Derived 
  }
}

