Why at certain times can you see both the moon and the sun?

I am just wondering what the answer is.

the moon doesn't vanish during the day. You just usually don't see it because the sun lights up the whole sky.

However, if you know where to look, you can usually see the moon during the day.