Heralded generation of a three-photon NOON state