Try this:
<a href="https://wordpress.stackexchange.com/questions/39742/<?php echo get_permalink($post->post_parent); ?>">Attachment parent</a>
Try this:
<a href="https://wordpress.stackexchange.com/questions/39742/<?php echo get_permalink($post->post_parent); ?>">Attachment parent</a>