Probably yes, but the target will usually be in half cover.
The GM will need to rule if the target receives a cover bonus to their AC. Normally, they should be considered to be in half cover, as the rules say that is what you get for being behind "a creature, whether that creature is an enemy or a
friend".
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 ... or a creature, whether that creature
is an enemy or a friend. (Basic Rules, p. 77)
But the GM might choose to make their own determination if they feel the sizes of the creatures warrant it (or they may simply forget that cover might apply here). For instance, a Giant or Dragon may not be much troubled by reaching over a medium sized creature (and so no cover might be given), whereas a small sized creature who gets their reach from a whip might have a much harder time (and so 3/4 or even full cover that prevents the attack might make sense).
Whether the attack is made on the attacking character's turn or as an opportunity attack on the target's turn should not matter.