This process is called induction of charge and happens instantly. Separate the spheres by a small distance while the glass rod is still near sphere A. The two spheres will be oppositely charged and attract each other and after removing the rod they will rearrange each other.