How can two players play a football based game, so that they can develop the necessary skills to play the actual game (when played with team) and at the same time enjoy the game?
Football is a team sport. There are several aspects to the game like passing, positioning, zonal marking, man marking, etc. which are lost when a person plays alone against an opponent. The skills that would be refined would be dribbling, shooting and tackling.
Instead, you can use your time with your friend to do drills. Drills that two players can comfortably assist each other with such as short passing, long passing, etc. Check out this guide for a good set of drills, which can be adapted to suit you and your friend.
If drills feel more like a chore than a fun activity, you can find ways to gamify it. Give points for repeatedly hitting a defined target, the number of sucessful dribbles without getting tackled, the number of successful tackles, etc. This way you would be motivated to compete with your friend while still improving your skills and having fun.