Quantum nondemolition measurement