how to return shared_ptr to current object from inside the "this" object itself
<p>I have an instance of View class (instantiated somewhere in the Controller owning object using shared_ptr)</p>

<pre><code>class ViewController {
protected:
    std::shared_ptr&lt;View&gt; view_;
};
</code></pre>

<p>This view has also method "hitTest()" that should return this view's shared_ptr to the outside world</p>

<pre><code>class View {
...
public:
std::shared_ptr&lt;UIView&gt; hitTest(cocos2d::Vec2 point, cocos2d::Event * event) {
...
};
</code></pre>

<p>How can I implement this method from inside the View? It should return this VC's shared_ptr to outside?
Obviously, I <strong>cannot</strong> make_shared(this) </p>

<pre><code>hitTest() {
...
    return make_shared&lt;View&gt;(this);
}
</code></pre>

<p>because it would break completely the logic: it just would create another smart pointer from the this raw pointer (that would be totally unrelated to owner's shared_ptr)
So how the view could know its external's shared_ptr and return it from inside the instance?</p>