This question is an exact duplicate of:
- Relative strengths of hydrogen bonds 1 answer
From NCERT class 12 part 1
The way I see hydrogen bonding is that it occurs due to intermolecular charge interaction. The more electronegative nitrogen/oxygen due to the inductive effect the respective hydrogen will be more electropositive.
Since the compound cointaining the more electronegative atom (oxygen/nitrogen) has greater respective charges.Then the hydrogen bonding will be greater between the molecules of that compound i.e either the hydrogen bonding between phenol-phenol and aniline-aniline should be greater than phenol-aniline.