 <p>Although <code>harry.getObject()</code> is a reference to the original object, you then ruin it with the assignment:</p> <pre><code>harry1 = harry.getObject(); </code></pre> <p>which performs a copy.</p> <p>Instead:</p> <pre><code>Student const&amp; harry1 = harry.getObject(); </code></pre>