FWIW, I require special training to attack with a pole arm from the second rank.
In any event, the ability of a second rank to attack with missile weapons depends (greatly) on whether the archers are aiming at targets (a small angle relative to the ground) or shooting volleys (at a larger angle). In the first case (the norm for RPGs), the ally would get in the way. In the latter case, you should be able to shoot from the first, second, third, etc. lines.