 <p><code>String *</code> means a pointer to a <code>String</code>, if you want to do anything with the <code>String</code> itself you have to dereference it with <code>*moj</code>. What you can do instead is this:</p> <pre><code>String moj = String("Alice has a cat"); // note lack of * and new cout &lt;&lt; moj[2]; </code></pre> <p>Also note that anything you allocate with <code>new</code> needs to be deleted after:</p> <pre><code>String *x = new String("foo"); // code delete x; </code></pre>