We establish the fluctuation theorem in the presence of information exchange between a nonequilibrium system and other degrees of freedom such as an observer and a feedback controller, where the amount of information exchange is added to the entropy production. The resulting generalized second law sets the fundamental limit of energy dissipation and energy cost during the information exchange. Our results apply not only to feedback-controlled processes but also to a much broader class of information exchanges, and provide a unified framework of nonequilibrium thermodynamics of measurement and feedback control.