The electrodes are connected with a metal wire in order to conduct the electrons that participate in the reaction.
In one half-cell, dissolved metal-B cations combine with the free electrons that are available at the interface between the solution and the metal-B electrode; these cations are thereby neutralized, causing them to precipitate from solution as deposits on the metal-B electrode, a process known as plating.
This reduction reaction causes the free electrons throughout the metal-B electrode, the wire, and the metal-A electrode to be pulled into the metal-B electrode. Consequently, electrons are wrestled away from some of the atoms of the metal-A electrode, as though the metal-B cations were reacting directly with them; those metal-A atoms become cations that dissolve into the surrounding solution.