Here's why:
* Atoms are made up of protons, neutrons, and electrons. Protons have a positive charge, electrons have a negative charge, and neutrons have no charge.
* Friction causes the atoms of the two objects to rub against each other. This rubbing can dislodge electrons from their orbits around the atoms.
* Electrons are more loosely bound to atoms than protons. Therefore, it's easier for them to be transferred.
* The object that loses electrons becomes positively charged. This is because it now has more protons than electrons.
* The object that gains electrons becomes negatively charged. This is because it now has more electrons than protons.
Example:
If you rub a glass rod with a silk cloth, the electrons will be transferred from the glass rod to the silk cloth. The glass rod will then become positively charged, while the silk cloth will become negatively charged.