title: Convert ifstream to istream
body: <p>How would one go about casting a ifstream into a istream. I figure since ifstream is a child of istream I should be able to do so but I have been having problems with such a task.</p>
  
  <pre><code>std::istream &amp; inputStr = std::cin;
    std::ostream &amp; outputStr = std::cout;
    if(argc == 3){
      std::fstream inputFile;
      inputFile.open(argv[1], std::fstream::in);
      if(!inputFile){
          std::cerr &lt;&lt; "Error opening input file";
          exit(1);
      }
      inputStr = inputFile;
  .....
  }
  </code></pre>