title: Boost python, returning a class from a method of another class
body: <p>My problem is that I have two classes like this</p>
  
  <pre><code>class B{
  public:
      double x,y;
  }
  
  class A{
  public:
      B foo();
  }
  
  
  BOOST_PYTHON_MODULE(interestingLib){
      class_&lt;A&gt;("A")
          .def("foo", &amp;A::foo)
      ;
      class_&lt;B&gt;("B")
          .def_readonly("x",&amp;B::x)
          .def_readonly("y",&amp;B::y)
      ;
  }
  </code></pre>
  
  <p>in my python script I call my function <code>foo</code> and get the return, after that I want to see the member variable <code>x</code> like this</p>
  
  <pre><code>A = interestingLib.A
  B = A.foo()
  B.x
  </code></pre>
  
  <p>but I get the error <code>AttributeError: 'NoneType' object has no attribute 'x'</code></p>
  
  <p>could anyone tell me what the problem is?</p>