Quantum channels with memory