Prince William had 'secret agreement’ with Sun newspaper about phone hacking