title: Should I use shared_ptr or unique_ptr?
body: <p>I have a question about <a href="http://en.cppreference.com/w/cpp/memory/unique_ptr" rel="noreferrer"><code>std::unique_ptr</code></a> and <a href="http://en.cppreference.com/w/cpp/memory/shared_ptr" rel="noreferrer"><code>std::shared_ptr</code></a>. I know there are loads of questions about when to use which one, but I'm still not sure if I understand it correctly. I read somewhere that the default choice for smart pointer should be <code>std::unique_ptr</code>, but as I understand it, for my needs I should rather use <code>std::shared_ptr</code>. For example, I have:</p>
  
  <pre><code>class B;
  class A
  {
  private:
     B* b;
  public:
     B* getB();
  };
  
  A::getB()
  {
     return b;
  }
  </code></pre>
  
  <p>So basically class <code>A</code> owns pointer to object of type <code>B</code> and there's a method which returns this pointer. If I create getter, I assume that some other class can access this pointer and therefore it should be <code>shared_ptr</code> instead of <code>unique_ptr</code>. Am I right, or I don't get it yet?</p>