Quantum-mechanical Maxwell’s demon