title: Create shared_ptr from reference
body: <p>I'm relativly new to C++ and this seams like a noob question but I wasn't able to solve it with other resources on the internet.</p>
  
  <p>I'm trying to create a shared_ptr from a reference. I have following <code>Book</code> class:</p>
  
  <pre><code>#include &lt;memory&gt;
  #include "Author.hpp"
  
  class Book
  {
     public:
        void setAuthor(const Author&amp; t_author);
  
     private:
        std::shared_ptr&lt;Author&gt; m_author;
  }
  </code></pre>
  
  <p>And this is my <code>Author</code> class:</p>
  
  <pre><code>#include &lt;memory&gt;
  class Book;
  
  class Author
  {
     public:
        void addBook(const Book&amp; t_book);
  
     private:
        std::vector&lt;std::weak_ptr&lt;Book&gt;&gt; m_books;
  }
  </code></pre>
  
  <p>I tired to implement the <code>Book::setAuthor</code> method like so:</p>
  
  <pre><code>void Book::setAuthor(const Author&amp; t_author)
  {
     m_author = std::shared_ptr&lt;Author&gt;(&amp;t_author);
  }
  </code></pre>
  
  <p>But if I try to compile this I get:</p>
  
  <blockquote>
    <p>Invalide conversion from const Author* to Author*</p>
    
    <p>Invalide conversion from sizeof to const Author</p>
  </blockquote>
  
  <p>Can you please tell me what is wrong with my code? I also tried the same with the weak_ptr but this does not work either.</p>