Where can pseudo-force be used? I was doing this question

and eventually got the answer but I had a thought :- 
It being a non inertial frame , can we apply pseudo force on it?
But as the question says both are travelling with same acc. . That's where I got stuck because I read somewhere that in addition to a non-inertial frame there has to be a relative motion between the bodies in order to apply pseudo force . 
In addition to all of this I found a Sol. to the same problem in another book where there is no mention of a pseudo force but the FBD drawn has $ma$ as you can see . I assume it is pseudo force by judging the way the sol. was written . 

This contradicts my above statement . 
Now I am more confused than what I was before and now I do no not understand where pseudo force can actually be used. 
 A: 
It being a non inertial frame , can we apply pseudo force on it?

If you moved along with the system then you would need to do this. But nothing says we can't analyze an accelerating system from an inertial frame. In fact, this is typically what is done, especially in intro physics questions such as these.

I read somewhere that in addition to a non-inertial frame there has to be a relative motion between the bodies in order to apply pseudo force .

This is incorrect. If you are in a non-inertial frame then pseudoforces will be present. That's all. (With your statement, single body systems would not experience pseudoforces).

In addition to all of this I found a Sol. to the same problem in another book where there is no mention of a pseudo force...

Either they are doing what I mentioned at the beginning of this answer. Although the $ma$ term shouldn't be on the diagram if that's the case. Or $ma$ is the pseudoforce, which is what you would need to do if you moved with the system.
A: So first let's summarize the topics in the problem:- 1) friction and it's limiting value 2) Newton's second law 3) Pseudo Force (not as such but let's see). The condition for relative slipping between two objects is that they should have a non zero magnitude of relative acceleration hence we have no slipping till $ a_{rel}=0 $ ( in this case all credits to @aleph zero for sporting the glitch ) now we know that if the slipping is not happening then friction has to be static in nature and hence we have an upper limit to our frictional force between the two blocks as $ μmg $ . So we need to find F such that frictional force reaches it's maximum value. So far I have not used Pseudo Force which now I will introduce. Let's dive into the frame of the lower block. With respect to it the upper block is at rest ( as there is no slipping) and as our frame is accelerated ( as the whole system of the two blocks  is moving on the smooth ground) we need to apply a Pseudo Force $ F=ma $ in the opposite direction to the acceleration of the frame and then we are allowed to apply Newton's laws in that frame and write the equilibrium equations using FBD as explained in fig.2  of your question. I hope my answer helped you please feel free if you want to suggest changes or ask more ! 
