Single-photon transistor in circuit quantum electrodynamics