input: Write a function to implement a WordCounter class that reads a text file and counts the frequency of each word. The class should have a method to return the word counts.
  assert WordCounter('example.txt').get_word_counts()=={'This': 1, 'is': 1, 'a': 1, 'test': 1, 'text': 1, 'file': 1}
  assert WordCounter('empty.txt').get_word_counts()=={}
  assert WordCounter('repeated.txt').get_word_counts()=={'the': 3, 'quick': 1, 'brown': 1, 'fox': 2}
  assert WordCounter('numbers.txt').get_word_counts()=={'1': 1, '2': 1, '3': 1, 'four': 1}
  assert WordCounter('special_chars.txt').get_word_counts()=={'word!': 2, 'word@': 1, 'word#': 1}
output: class WordCounter:
      def __init__(self, filename):
          self.word_counts = {}
          with open(filename, 'r') as file:
              for line in file:
                  words = line.split()
                  for word in words:
                      if word in self.word_counts:
                          self.word_counts[word] += 1
                      else:
                          self.word_counts[word] = 1
  
      def get_word_counts(self):
          return self.word_counts