From Wikipedia
A hat-trick occurs in cricket when a bowler dismisses three batsmen
with consecutive deliveries. The deliveries may be interrupted by an
over bowled by another bowler from the other end of the pitch or the
other team's innings, but must be three consecutive deliveries by the
individual bowler. Only wickets attributed to the bowler count towards
a hat-trick; run outs do not count.
Here one thing we have to remind is that, there is no official definition or law for Hat-Tricks. There are no official wordings or like that as how a Hat-Trick is achieved. It is more commonly a term used by media and others who see this an individual achievement by a player. So basically it is to be left with each person's perspective as to which one is a Hat-Trick or which one is not.
Like asked in this question one can argue over a Hat-Trick with a wide ball(or no-ball) in between.
Anyway in the same link I provided, there are some peculiar Hat-Tricks explained, like the one you asked.
Some hat-tricks are particularly extraordinary. On 2 December 1988,
Merv Hughes, playing for Australia, dismissing Curtly Ambrose with the
last ball of his penultimate over and Patrick Patterson with the first
ball of his next over, wrapping up the West Indies first innings. When
Hughes returned to bowl in the West Indies second innings, he trapped
Gordon Greenidge lbw with his first ball, completing a hat-trick over
two different innings and becoming the only player in Test cricket
history to achieve the three wickets of a hat-trick in three different
overs.
So you can say it is a Hat-Trick spread over two innings/match or you dont agree at all. As I said above it is each person's perspective.