You need to create the dependency, and make sure Mod A is present (in deobfuscated form) in the dev environment for Mod B as well the eventual run environment (in obfuscated form) for the user. Basically Mod A becomes a library to Mod B.
Here's what I think you need to do (others can correct me):
You would specify the dependency in Mod B's @Mod annotation. You would specify that Mod A loads before Mod B generally.
Fill in the dependencies block in your build.gradle. (I think there are comments in the template that will guide you.)
Add the deobfuscated version of Mod A source code jar to your Mod B project class path. I think that when you build your Mod A jar it also creates a deobfuscated version, but maybe you need to run special build option.
Recommended to add a dependencies section in mcmod.info. This is informational.