Can I connect an inverter supply and AC mains supply in parallel?
You are seeking two very different things: 1) solar+battery power during long power outages. 2) Backfeeding to the grid to unwind your electric meter.  There is no magic faerie to just make all this work together.

Grid-tie: There's a standard for that, called UL 1741.

It was solved decades ago.  It does one very important thing that perhaps you aren't thinking about: It assures your backfeeding shuts off if the grid is lost. 

Imagine if that did not happen: Imagine if a tree knocks over a power line, and your power fails, and your solar just keeps on generating.  Woohoo, lights stay on, right?  No.  AC power is not magic.   It doesn't know to stop at your main breaker.  So it continues beyond your main breaker, tries to power all your neighbors' houses, and also energizes the supply transformer that normally kicks 7200V distribution power down to 120/240V.  Transformers are two-way.  So this lights up the 7200V.  Even if the wires that fell were on the dead side, you just made them live.

UL 1741 requires the inverter to sense the loss of grid power and shut down itself.  If you do not provide this functionality in your inverter, you will not attach it to North American mains. Maybe Somali mains :)

Not to be confused with a "make AC from battery" inverter

A UL 1741 is a more complicated inverter than a "make AC from battery" inverter.  And obviously, incompatible to the task. 

The simplest way is to use a different inverter.  You have a subpanel with a transfer switch. When mains is available, the panel takes from utility. When not, the panel takes from your "from battery" inverter. 

Your solar charge controller charges your battery, and then, it has an extra set of terminals called "DUMP" where it sends power after the battery is full.  You connect a (separate) UL 1741 inverter to the DUMP terminals, and that to the grid. 

In this scenario, the power company will need to inspect the main panel, UL 1741 inverter, and transfer switch.  Beyond that, they won't care. 

Your local AHJ will care about the AC subpanel, but they'll treat it lightly if they see it's competent. 

I want to use the same inverter for both jobs

Meeeeeeeehhhhh.... You can do that - Tesla PowerWalls do that - but the problem is, the amount of external switchgear you need to provide powerline-safety interlocking will probably cost more than the second inverter.  

Go look at a grid-tie + PowerWall installation, there's a lot going on.  It's not just PowerWall into a breaker, done; there's a lot of other apparatus. 

The power company needs to inspect and sign off on the whole complicated mess. They won't accept anything that doesn't have a UL listing. There'll be no room to homebrew anything.  

So the "one inverter, both jobs" thing is not worth pursuing IMO, unless you just want to throw money at a commercial setup like the PowerWall.