David was so huge as the Doctor, Matt is so huge as the Doctor that both of them contemplated the other I think as the “real” Doctor. You never think of you, yourself as the Doctor, you think someone else is. Matt watched David as the Doctor and loved him and David being a huge fan of Doctor Who continued to watch the show after he left so he considered Matt to be the Doctor. So I think there was a moment where they might have thought they were both frauds in the presence of the other but rather magically and rather wonderfully they got on hugely well - I suppose because they’re the two people that have led that life and can talk about it in detail so most of the time making the special you’d see them in the corner together chatting and gossiping away. As people are about to see it’s genuinely a very funny double act and it really works.
Steven Moffat on having Matt Smith and David Tennant working together in the 50th Anniversary special.