Stream comparable?

I have tried today to compare my declared Stream& stream that could be Serial, Serial1....,Serial3. To use the same code and define in a function the serial port to use, does it exists something like that?

if(stream == Serial) {.......}

I got the error that the stream class does not have this operation. Is it possible to see if it is used for example Serial1 in a function and if yes, then make this, else make that?

It would be much better if you had posted a complete code. Lacking that, all I can do is guess. Try:

if(&stream == &Serial) {.......}

You are too abstracted to use the compare operator

Thanks to both answers! It is not working this way. If I declare it as &stream == &Serial it compiles nearly without issues (it says, it contains a unsigned long and overflows), but does not make something.
Perhaps it is possible with switch/case?

  case Serial: ......
  case Serial3: .....

I will post some code soon. I have to finish it to post something that makes a little sense.

Post an MRE. That's the smallest complete code that compiles and demonstrates the problem. Leave out any extraneous clutter that's unrelated to the problem.