Basic Plumbing 101 says you should never connect dissimilar metal fittings together
Online sources are mixed but some say you can mix 304 stainless with brass

Mixing Brass and Stainless-Steel Fittings
Mixing brass and stainless-steel fittings is not very common and shouldn't be overlooked. Learn why in this blog post by Brennan Industries.

"The metals should be listed on the anodic index with no more than a .15V to .25V difference between them. Since brass and 410 stainless steel are seven metals apart, they can rust. On the other hand, brass and 301, 304 and 310 stainless steels are only two metals apart, making it possible to link them safely with little chance of galvanic corrosion. This is why it is essential to know the types of brass and stainless steel when mixing. Though stainless steel 304 has a higher melting point, stainless 316 has a superior resistance to chemicals and salt compared to 304. That’s why 316 stainless steel is the most common grade in hydraulic and instrumentation fittings, especially in applications with chlorinated solutions or exposure to salt."