title: Cython: how to pass a c++ class as an argument to a Cython class that wraps the c++ class?
body: <p>I am fighting with CYTHON, trying to make a copy of a C++ class in a Python class.
  I the .pxd I have:</p>
  
  <pre><code>cdef extern from "MyCppClass.h":
      cdef cppclass MyCppClass:
          MyCppClass ()
          int        Copy(MyCppClass * Source)
  
  
  cdef class MyPyClass:
      cdef MyCppClass * thisptr
      cdef copy(self, MyCppClass *s)
  </code></pre>
  
  <p>and in the .pyx I have</p>
  
  <pre><code>cdef class MyPyClass: 
      def __init__(self): 
          self.thisptr = new MyCppClass ()
  
      cdef copy(self, MyCppClass * s):    
           self.thisptr.Copy(s)
  </code></pre>
  
  <p>The compilation is ok.</p>
  
  <p>Then I try to use it in another Cython module:</p>
  
  <pre><code>A=new MyCppClass()
  pA=MyPyClass()
  … do some stuff on A
  p1.copy(A)
  </code></pre>
  
  <p>And I get the usual “cannot convert to Python object”
  I have tried a lot of things to copy, like :</p>
  
  <pre><code> cdef getThisptr(self):
      return self.thisptr
  
  A=new MyCppClass()
  pA=MyPyClass()
  B=pA.getThisptr()
  B.Copy(A)
  </code></pre>
  
  <p>But nothing works!</p>
  
  <p>It sounds very basic in Cython, but I am still waiting for a solution…</p>