Yes, but they will have half cover
The rules on cover are listed here. The total cover rule is the only one that prevents attacking:
A target with total cover can’t be targeted directly by an attack or a
spell, although some spells can reach such a target by including it in
an area of effect. A target has total cover if it is completely
concealed by an obstacle.
Allies don’t give total cover though, they give half cover:
A target with half cover has a +2 bonus to AC and Dexterity saving throws. A target has half cover if an obstacle blocks at least half of its body. The obstacle might be a low wall, a large piece of furniture, a narrow tree trunk, or a creature, whether that creature is an enemy or a friend.
So you can attack “through” an ally but the target will have half cover from the attack.