The first problem with your example is that boost::python::class_ bodies should not go inside curly braces - they aren't a macro or a new kind of function, they're just template classes with a lot of fancy operator overloading, so what you really want is something like this:
class_<B>("B", init<std::string,A*>())
.def("my_foo", &B::my_foo)
;
In that snippet, you can see the fix you need for init to compile - just pass A* as a template parameter instead of 'A'. That should be enough to get it to compile.
Whether that's enough for it to do what you want depends on what the constructor for B does with the pointer it is passed. If it simply uses it in the scope of the constructor, or it deep-copies it, you're fine. But if it holds onto that pointer (e.g. as a data member), then you could run into trouble if the A object goes out of scope before the B object does. If that's the case, you would want to use the with_custodian_and_ward policy, which I think would look something like this:
init<std::string,A*>()[with_custodian_and_ward<1,3>()]
The integer template arguments to with_custodian_and_ward refer to positional arguments to the __init__ method; 1 refers to self, and 3 refers to the A* argument, so this means "keep the A object passed to the constructor alive until the constructed B object is destroyed."
You can find more information here:
http://www.boost.org/doc/libs/1_52_0/libs/python/doc/v2/with_custodian_and_ward.html
A*fromboost::python::object. Have you wrappedAclass?Bis private. Post complete code please.