I have a slight confusion regarding the application of Newton's 2nd law in a situation where there are two blocks, of mass $m_1$ and $m_2$, which are stacked on top of each other and placed on a frictionless surface. The interface between the two blocks is not frictionless. A force $F$ is applied to the bottom block, of mass $m_1$, causing the blocks to accelerate, as shown in the image below (where I have identified some forces):
There are frictional forces exerted upon the two blocks (due to Newton's Third law), which I have drawn in the image. To find the acceleration of the block at the bottom, I tried to applied Newton's 2nd law in the following way:
$$m_2: \sum F = F - F_f = (m_1+m_2)a$$ $$\iff a = \frac{F-F_f}{m_1+m_2}$$
However, the solution states that
$$a = \frac{F-F_f}{m_1}$$
I am confused as to why the net force acting on the block of mass $m_1$ should be divided by $m_1$ rather than $m_1+m_2$, since the two blocks are stacked together, so could be considered as a single object with mass $m_1+m_2$?
This is probably a silly misconception, but I would greatly appreciate it if anyone would be able to help explain this to me. Thank you in advance!